/*
 *
 * This file is part of the open-source SeetaFace engine, which includes three modules:
 * SeetaFace Detection, SeetaFace Alignment, and SeetaFace Identification.
 *
 * This file is part of the SeetaFace Detection module, containing codes implementing the
 * face detection method described in the following paper:
 *
 *
 *   Funnel-structured cascade for multi-view face detection with alignment awareness,
 *   Shuzhe Wu, Meina Kan, Zhenliang He, Shiguang Shan, Xilin Chen.
 *   In Neurocomputing (under review)
 *
 *
 * Copyright (C) 2016, Visual Information Processing and Learning (VIPL) group,
 * Institute of Computing Technology, Chinese Academy of Sciences, Beijing, China.
 *
 * The codes are mainly developed by Shuzhe Wu (a Ph.D supervised by Prof. Shiguang Shan)
 *
 * As an open-source face recognition engine: you can redistribute SeetaFace source codes
 * and/or modify it under the terms of the BSD 2-Clause License.
 *
 * You should have received a copy of the BSD 2-Clause License along with the software.
 * If not, see < https://opensource.org/licenses/BSD-2-Clause>.
 *
 * Contact Info: you can send an email to SeetaFace@vipl.ict.ac.cn for any problems.
 *
 * Note: the above information must be kept whenever or wherever the codes are used.
 *
 */

#ifndef SEETA_FD_CLASSIFIER_MLP_H_
#define SEETA_FD_CLASSIFIER_MLP_H_

//#include <cmath>
//#include <memory>
//#include <algorithm>
#include <stdbool.h>
#include<stdint.h>
#include "math_func.h"

typedef struct classMLPLayer MLPLayer;
struct classMLPLayer{

  int32_t act_func_type_;
  int32_t input_dim_;
  int32_t output_dim_;
 float* weights_;
 float* bias_;
};
void ReleaseMLPLayer(struct classMLPLayer *p);
void MLPLayerCompute(struct classMLPLayer *p, const float* input, float* output);

//void InitMLPLayer(struct classMLPLayer *p, int32_t act_func_type = 1, int32_t input_dim = 0, int32_t output_dim = 0);
void InitMLPLayer(struct classMLPLayer *p, int32_t act_func_type , int32_t input_dim , int32_t output_dim );

int32_t MLPLayerGetInputDim(struct classMLPLayer *p);
int32_t MLPLayerGetOutputDim(struct classMLPLayer *p);
void MLPLayerSetSize(struct classMLPLayer *p, int32_t inputDim, int32_t outputDim);
void MLPLayerSetWeights(struct classMLPLayer *p, const float* weights, int32_t len);
void MLPLayerSetBias(struct classMLPLayer *p, const float* bias, int32_t len);
float MLPLayerSigmoid(float x);
float MLPLayerReLU(float x);

typedef struct classMLP MLP;
struct classMLP{
  MLPLayer* layers_;
  float* layer_buf_[2];
};
void InitMLP(struct classMLP *p);
void ReleaseMLP(struct classMLP *p);
void MLPCompute(struct classMLP *p, const float* input, float* output);
//void MLPAddLayer(struct classMLP *p, int32_t inputDim, int32_t outputDim, const float* weights,const float* bias,int list, bool is_output = false);
void MLPAddLayer(struct classMLP *p, int32_t inputDim, int32_t outputDim, const float* weights, const float* bias, int list, bool is_output );
int32_t MLPGetInputDim(struct classMLP *p);

int32_t MLPGetOutputDim(struct classMLP *p);

int32_t MLPGetLayerNum(struct classMLP *p);

#endif  // SEETA_FD_CLASSIFIER_MLP_H_
